from tortoise import fields
from .base import BaseModel, UserMixin, TimestampMixin, DeletedMixin
from tortoise.contrib.pydantic import pydantic_model_creator

class Role(BaseModel, UserMixin, TimestampMixin, DeletedMixin):
    """
    角色模型类
    """
    name = fields.CharField(max_length=50, unique=True, description="角色名称")
    code = fields.CharField(max_length=20, unique=True, description="角色代码")
    enable = fields.BooleanField(default=True, description="是否启用")
    description = fields.CharField(max_length=200, description="角色描述")

    class Meta:
        db_table = "sys_role"
        description = '角色表'

Role_pydantic = pydantic_model_creator(Role, name="Role")